 
<title><%= @post.title %></title>

<%= stylesheet_link_tag 'post_detail'%>

<div class="post-detail">
  <h2><%= @post.title %></h2>

  <% if session[:user_id] %>
    <div class="fixed">
      <div><%= @post.status %></div>
      <%= link_to "编辑", edit_post_path(@post)%>
      <%= link_to "删除", post_path(@post), :method => :delete, :data => {confirm: "你确定要删除这篇博客？"}%>
    </div>
  <% end %>

  <div class="post-info-wrapper">
    <div class="post-info">
      <span class="name"><%= @post.author.name %></span>
      <span class="on">created on</span>
      <time class="create-time"><%= @post.created_at.strftime('%b %d, %y') %></time>
      <span class="on">last updated on</span>
      <time class="create-time"><%= @post.updated_at.strftime('%b %d, %y') %></time>
    </div>
  </div>


  <div class="post-content">
    <%= markdown @post.content %>
  </div>

  <div class="tags">
    Tags:
    <% @post.tags.each do |tag| %>
      <%= link_to tag.name, search_by_tag_posts_path(tag.name) %>
    <% end %>
  </div>

  <div class="new-comment" id="#comments">

    <%= form_tag("/comments", method: :post, remote: true, id: "new-comment-form") do %>
      <%= hidden_field_tag(:post_id, @post.id) %>
      <label>
        <div>Email:</div>
        <%= text_field_tag(:email, '', :placeholder => "mail@example.com", :type => "email") %>
      </label>

      <label>
        <div>Username:</div>
        <%= text_field_tag(:name, '', :placeholder => "2 ~ 30 letters", :type => "text") %>
      </label>

      <label><div>Comment:</div></label>
      <%= text_area_tag(:content, '', :placeholder => "1 ~ 140 letters") %>
      <%= submit_tag("Submit", :id => "submit-new-comment", :class => "button") %>
    <% end %>

    <div class="comments-count">Comments (<span class="count"><%= @post.comments.size %></span> )</div>
  </div>

  <div class="comments" id="comments">
    <%= render @post.comments %>
  </div>

</div>

<%= javascript_include_tag "post_detail" %>
